const Base = require('./base.js');
var ObjectId = require('mongodb').ObjectId

module.exports = class extends Base {
  async indexAction() {

    const loglist = this.mongoose('mongoose/loglist');
    var result
    try{
      result = await loglist.find({'_id':ObjectId(this.get('id'))})
    }catch(e){
      this.ctx.fail(1000, e.message)
    }
    if (result.length > 0) {
      this.assign('json', JSON.stringify(result[0]));
    } else {
      this.ctx.fail(1000, '参数错误')
    }
    return this.display();
  }
};